-- Viral Resistance - T-Engine 4 Module
-- Copyright (C) 2010 Mikolai Fajer
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- Mikolai Fajer "yufra"
-- mfajer@gmail.com

module(..., package.seeall, class.inherit(engine.dialogs.ShowInventory))

-- Overwriting the parent method so that the dialog will only
-- unregister after action returns true
function _M:use(item)
	if item and item.object then
		finished = self.action(item.object, item.item)
	end
	if finished then
		game:unregisterDialog(self)
	else
		self:generateList()
		self.changed = true
	end
end